<?php

namespace App\Model\Traits;

use App\Model\Permission\User;
use Hyperf\Database\Model\Events\Booted;

trait HasCreator
{
    public function booted(Booted $query)
    {
        $query->getModel()->with(['creator']);
    }
    public function creating()
    {
        $this->creator_id = currentAdminUserId();
    }
    public function creator()
    {
        return $this->belongsTo(User::class);
    }
}
